<%@ page import="com.javaee.interceptor.entity.goods" %>
<%@ page import="java.util.List" %>
<%@ page import="static com.javaee.my.user.BaseControllerApi.sqlsession" %><%--
  Created by IntelliJ IDEA.
  User: asus
  Date: 2021/11/17
  Time: 19:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
    <title>超市</title>
<%
    List<goods> goodsList = sqlsession.selectList("com.javaee.my.dao.userMapper.queryAllgoods");
    application.setAttribute("goodsList",goodsList);
%>
</head>
<body>

<table border=1>
<tr>
    <td> 商品编号</td>
    <td> 商品名称</td>
    <td> 商品价格</td>
    <td> 商品数量</td>
</tr>
<%
    for (int i = 0; i < goodsList.size(); i++){
%>
<tr>
    <td><%=goodsList.get(i).getGoods_id()%></td>
    <td><%=goodsList.get(i).getGoods_name()%></td>
    <td><%=goodsList.get(i).getGoods_price()%></td>
    <td><%=goodsList.get(i).getGoods_nums()%></td>
</tr>
<%
    }
%>
</table>

<h3>订单名称<h3>
    <form action="superMarket" style="color: bisque;" method="post">
<%--        <select name="student" id="student" >--%>
<%--            <% if(goodsList.size()> 1) { %>--%>
<%--            <option value="选择物品"></option>--%>
<%--            <% } %>--%>
<%--            <%--%>
<%--                for (goods good: goodsList) {--%>
<%--            %>--%>
<%--            <option selected value="<%=good.getGoods_id()%>" name="goods_id">商品名称：<%=good.getGoods_name()%>--%>
<%--            </option>--%>
<%--            <%}--%>
<%--            %>--%>
            购买商品编号：<input type="number" name="goods_id" />
            购买商品数量：<input type="number" name="nums" oninput="if(value>10)value=10"/>
                        <input type="submit" value="提交" name="sub">
<%--        </select>--%>
    </form>
<%--    <form action="deleteGoods" style="color: bisque;" method="post">--%>
<%--    填写商品编号并删除：<input type="number" name="goods_id">--%>
<%--        <input type="submit" value="提交" name="sub">--%>
<%--    </form>--%>
    <a href="loginout" rel="external nofollow" rel="external nofollow" target="_top" style="position: absolute;top:25px;right:10px;">注销登录</a>


</body>
</html>
